package com.rambo.sdm.service.impl;

import com.rambo.sdm.dao.inter.UserPOMapper;
import com.rambo.sdm.dao.pojo.UserPO;
import com.rambo.sdm.service.inter.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class UserServiceImpl implements UserService {
    private UserPOMapper UserPOMapper;

    @Autowired
    public UserServiceImpl(UserPOMapper UserPOMapper) {
        this.UserPOMapper = UserPOMapper;
    }

    public UserPO findUserByUuid(String uuid) {
        return UserPOMapper.selectByPrimaryKey(uuid);
    }

    public int addUser(UserPO user) {
        return UserPOMapper.insertSelective(user);
    }

    public int updateUser(UserPO user) {
        return UserPOMapper.updateByPrimaryKeySelective(user);
    }

    public int deleteUserById(String uuid) {
        return UserPOMapper.deleteByPrimaryKey(uuid);
    }

    public List<UserPO> getUserList() {
        return UserPOMapper.selectByExample(null);
    }
}
